home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Graphics / nxyplot / Source / ScrollWindow.h < prev    next >
Text File  |  1991-10-21  |  3KB  |  53 lines

  1. // The ScrollWindow class is from David S. Joerg (joerg@alliant.mcs.anl.gov)
  2. // It was posted to the net in 1990 and is in the archives at Purdue and Oregon State.
  3. // It is a bit of overkill for this application, since in the lineMatrix and
  4. // symbolMatrix windows we only need to scroll horizontally, and in the legendForm
  5. // window we only need to scroll vertically.  Nevertheless, it works, and it may
  6. // be handy to be able to shrink the windows down to a very small size.
  7. // Here is the README file that was posted with it:
  8. //-------------------------------------------------------------------------------
  9. // Autoresizing is a very nice Appkit feature.  However, for some Views
  10. // it just doesn't make sense to autoresize.  One day I was looking at
  11. // the IB palette, and I noticed that it was completely resizable, but
  12. // none of the interior elements changed.  When the palette window was
  13. // smaller than a certain size, >BANG<, a scroller appeared.  I'm always
  14. // low on screen space, so I loved it.  ScrollWindow does just about the
  15. // same thing.  If you're using IB, ScrollWindow is easy to use: 1) make
  16. // your IB Project recognize the ScrollWindow (subclass Window, Parse).
  17. // 2) change the desired window's class from Window to ScrollWindow.  3)
  18. // tell the ScrollWindow to becomeScrollWindow at some point in the
  19. // initialization sequence (at appDidInit time works for me).  Or, if
  20. // you're not using IB, you should just [ScrollWindow new] or
  21. // [ScrollWindow newContent:blah:blahblah...] and once you've filled the
  22. // ScrollWindow with Views, tell it to becomeScrollWindow.
  23. //
  24. // You _can_ add more Views or do things to your ScrollWindow after
  25. // you've told it to becomeScrollWindow, but the important thing to
  26. // remember is that you shouldn't touch [someScrollWindow contentView];
  27. // rather, you should message [[someScrollWindow contentView] docView].
  28. // This is because becomeScrollWindow places the old contentView one
  29. // level lower in the View hierarchy, under a newly-created ScrollView.
  30. //
  31. // Unfortunately, a ScrollWindow doesn't send the
  32. // windowWillResize:toSize: or windowDidResize: messages to its delegate.
  33. // It is possible (and easy) to make ScrollWindow do this, but I think it
  34. // would involve NXReponsibleDelegate() and I just didn't want the mess.
  35. //
  36. //  A trivial, yet elegant, piece of code.  Enjoy.
  37. //
  38. //  David S. Joerg
  39. //  MindShock, Inc.
  40. //  Internet : joerg@alliant.mcs.anl.gov
  41. //--------------------------------------------------------------------------------
  42. #import <appkit/Window.h>
  43.  
  44. @interface ScrollWindow:Window
  45. { NXSize minFrameSize; }
  46.  
  47. - becomeScrollWindow;
  48. - setMinFrameSize:(NXSize) newSize;
  49. - windowWillResize:sender toSize:(NXSize *)frameSize;
  50. - windowDidResize:sender;
  51.  
  52. @end
  53.